﻿Imports HMSLibrary
Imports System.Data
Imports HMSDataLayer

Public Class SearchWindow
    Public Property ConnectionString As String
    Private Sub CommandBinding_Executed(ByVal sender As System.Object, ByVal e As System.Windows.Input.ExecutedRoutedEventArgs)
        MessageBox.Show(
            String.Format("Command: {0}\nParameter: {1}\nSource: {2}\nOriginal Source: {3}",
                   e.Command, e.Parameter, e.Source, e.OriginalSource),
            e.RoutedEvent.Name)
        e.Handled = True
    End Sub

    Public Property FormType As FormsList = FormsList.None
    Dim DataCollection As Object

    Private Sub SearchWindow_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        Dim DataObject As MasterDataLayer
        If FormType = FormsList.PatientRegistration Then
            Dim DataObject1 As New PatientDataLayer()
            DataCollection = DataObject1.GetPatientList
        ElseIf FormType = FormsList.ItemsServices Then
            DataObject = New MasterDataLayer()
            DataCollection = DataObject.GetItemList
        ElseIf FormType = FormsList.Lookup Then
            DataObject = New MasterDataLayer()
            DataCollection = DataObject.GetLookupList
        ElseIf FormType = FormsList.Users Then
            DataObject = New MasterDataLayer()
            DataCollection = DataObject.GetUsersList
        ElseIf FormType = FormsList.Vendor Then
            DataObject = New MasterDataLayer()
            DataCollection = DataObject.GetVendorList
        ElseIf FormType = FormsList.Banks Then
          
        ElseIf FormType = FormsList.Employee Then
            DataObject = New MasterDataLayer()
            DataCollection = DataObject.GetEmployeesList
        ElseIf FormType = FormsList.Doctors Then
            DataObject = New MasterDataLayer()
            DataCollection = DataObject.GetDoctorsList
        ElseIf FormType = FormsList.Complaints Then
            DataObject = New MasterDataLayer()
            DataCollection = DataObject.GetComplaintsList
        ElseIf FormType = FormsList.Departments Then
            DataObject = New MasterDataLayer()
            DataCollection = DataObject.GetDepartmentsList
        ElseIf FormType = FormsList.Rooms Then
            DataObject = New MasterDataLayer()
            DataCollection = DataObject.GetRoomsList
        ElseIf FormType = FormsList.Wards Then
            DataObject = New MasterDataLayer()
            DataCollection = DataObject.GetWardsList
        End If
        SearchDataGrid.ItemsSource = Nothing
        SearchDataGrid.ItemsSource = DataCollection
    End Sub

    Private Sub MainWindow_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles Me.MouseDown
        Try
            DragMove()
        Catch ex As Exception
            AppCommon.LogError(ex)
        End Try
    End Sub

    Private Sub CloseButton_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles CloseButton.Click
        Me.Close()
    End Sub
End Class
